package com.yf.dxapp.module.app.dal.mysql.appuser;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.yf.dxapp.module.app.controller.admin.appuser.vo.AppUserPageReqVO;
import com.yf.dxapp.module.app.dal.dataobject.appuser.AppUserDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AppUserMapper extends BaseMapperX<AppUserDO> {

    default PageResult<AppUserDO> selectPage(AppUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AppUserDO>()
                .eqIfPresent(AppUserDO::getOpenId, reqVO.getOpenId())
                .eqIfPresent(AppUserDO::getUnionId, reqVO.getUnionId())
                .eqIfPresent(AppUserDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(AppUserDO::getMobile, reqVO.getMobile())
                .likeIfPresent(AppUserDO::getName, reqVO.getName())
                .eqIfPresent(AppUserDO::getCode, reqVO.getCode())
                .eqIfPresent(AppUserDO::getTCode, reqVO.getTCode())
                .eqIfPresent(AppUserDO::getRid, reqVO.getRid())
                .eqIfPresent(AppUserDO::getPid, reqVO.getPid())
                .eqIfPresent(AppUserDO::getTeam, reqVO.getTeam())
                .eqIfPresent(AppUserDO::getLevelId, reqVO.getLevelId())
                .betweenIfPresent(AppUserDO::getTime, reqVO.getTime())
                .eqIfPresent(AppUserDO::getStatus, reqVO.getStatus())
                .eqIfPresent(AppUserDO::getPassword, reqVO.getPassword())
                .eqIfPresent(AppUserDO::getRemark, reqVO.getRemark())
                .eqIfPresent(AppUserDO::getVip, reqVO.getVip())
                .eqIfPresent(AppUserDO::getTeamLv, reqVO.getTeamLv())
                .eqIfPresent(AppUserDO::getTeamCode, reqVO.getTeamCode())
                .eqIfPresent(AppUserDO::getZsVip, reqVO.getZsVip())
                .eqIfPresent(AppUserDO::getPercent, reqVO.getPercent())
                .eqIfPresent(AppUserDO::getManLv, reqVO.getManLv())
                .eqIfPresent(AppUserDO::getFid, reqVO.getFid())
                .eqIfPresent(AppUserDO::getDyNumber, reqVO.getDyNumber())
                .betweenIfPresent(AppUserDO::getLvTime, reqVO.getLvTime())
                .eqIfPresent(AppUserDO::getMiniOpenId, reqVO.getMiniOpenId())
                .betweenIfPresent(AppUserDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AppUserDO::getId));
    }

}